<template>
    <el-menu active-text-color="#ffd04b" background-color="#545c64" class="el-menu-vertical-demo" default-active="2"
        text-color="#fff" style="height: 100%;">
        <!-- <el-sub-menu index="1">
            <template #title>
                <span>用户管理</span>
            </template>
<el-menu-item index="1-1" @click="navTo('CollegeList')">注册</el-menu-item>
<el-menu-item index="1-2" @click="navTo('CollegeAdd')">用户列表</el-menu-item>
</el-sub-menu> -->
        <el-sub-menu index="1">
            <template #title>
                <span>兔子管理</span>
            </template>
            <el-menu-item index="1-1" @click="navTo('Rabbitlist')">兔子溯源</el-menu-item>
            <el-menu-item index="1-2" @click="navTo('RabbitDetails')">兔子溯源详情</el-menu-item>
        </el-sub-menu>


        <el-menu-item index="2-1" @click="logout">退出登录</el-menu-item>
    </el-menu>
</template>


<script setup lang="ts">
import { useRouter } from 'vue-router';

const router = useRouter();

const navTo = (name: string) => {
    router.push({
        name: name
    })
}

//退出登录
const logout = () => {

    //移除本地存储对象
    localStorage.removeItem("accountName");
    //跳转到登录页面
    router.push({
        name: "Logins"
    })
}

</script>